package com.edu.shiro.service.impl;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.edu.shiro.mapper.SysMenuMapper;
import com.edu.shiro.service.SysMenuService;

@Service
public class ISysMenuService implements SysMenuService {
	
	@Autowired
	private SysMenuMapper menuMapper;

	@Override
	public Set<String> selectPermsByUserId(Long userId) {
		List<String> perms = menuMapper.selectPermsByUserId(userId);
        Set<String> permsSet = new HashSet<>();
        for (String perm : perms)
        {
            if (null != perm && !"".equals(perm))
            {
            	permsSet.add(perm.trim());
            }
        }
        return permsSet;
	}

}
